package com.test3;
/**
 * 泛型接口
 * 语法：接口名<T>
 */
public class MyInterface<T> {
    public static void main(String[] args) {
        InterfaceImpl impl = new InterfaceImpl();
        impl.server("asdsfs");//asdsfs

        InterfaceImpl1 impl1 = new InterfaceImpl1();
        impl1.server(1243213);//1243213
    }
}
interface InterfaceTest<T> {
    T server(T t);
}
//指定泛型
class InterfaceImpl implements InterfaceTest<String> {

    @Override
    public String server(String s) {
        System.out.println(s);
        return s;
    }
}
//不指定泛型
class InterfaceImpl1<T> implements InterfaceTest<T> {

    @Override
    public T server(T t) {
        System.out.println(t);
        return null;
    }
}